<?php
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl.'/css/dispatch.css');
$type=DOCTYPE_DISPATCH;
 Yii::app()->clientScript->registerScript('list', <<<DOCHERE
       var dispatch= '$model->dispatch';    
       var locno='$model->locno';
       var custno='$model->custno';
       var type= $type;
DOCHERE
        , CClientScript::POS_HEAD); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/documents.js',CClientScript::POS_END);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/dispatchequipment.js',CClientScript::POS_END);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/dispatchpart.js',CClientScript::POS_END);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/dispatchtech.js',CClientScript::POS_END);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/dispatchupdate.js',CClientScript::POS_END);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/dispatchcustomernote.js',CClientScript::POS_END);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/dispatchtechnote.js',CClientScript::POS_END);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/dispatchSignatures.js',CClientScript::POS_END);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/equipmentwarranty.js',CClientScript::POS_END);?>
<?php 

if($dispatchLevel !== false):?>
<div id="billingTitleBar" style="height:40px;background-color:black;text-align:center;font-size:1.5em;color:white">
    <span id="billingTitleText" style="line-height: 41px;height: 50px;">DISPATCH BILLING - LEVEL <?php echo $dispatchLevel; ?></span>
</div>

<?php endif; ?>
<div id="left-col">
    <?php $this->renderPartial("_side",array(
        'location'=>$model->location,
        'dispatch'=>$model,
        'dispatchLevel'=>$dispatchLevel,
        'contacts'=>$contacts
    )); 
    if($model->complete != null){

        $this->renderPartial("_dpdetailPanel",array(        
            'dispatch'=>$model
        ));    

    }?>       
    

</div>

<div id="right-col">

    <div class="wrap">
        <div class="container">

            
            <div id="breadcrumb" style="display:none;"><span style="padding-left:10px;font-size:10px;color:#777777;" id="alsoviewing"></span></div>
            <div class="inside">
                <?php 
                $this->renderPartial('_view',array(
                    'dispatch'=>$model,
                    'location'=>$model->location,
                    'dispatchLevel'=>$dispatchLevel
                ));
                ?>                                           
                <br/>
                <ul id="tab" class="tabs tabs-with-summary">
                    <li class="active"><a class="atab" href="#info">Dispatch Info</a></li>
                    <li><a class="atab" href="#technician">Tech logs</a></li>
                    <li><a class="atab" href="#equipments">Equipments</a></li>
                    <li><a class="atab" href="#document">Documents</a></li>
                    <li><a class="atab" href="#part">Parts</a></li>
                    <li><a class="atab" href="#customerNote">Customer Note</a></li>
                    <li><a class="atab" href="#techNote" id="techNoteMenuLink">Tech Note</a></li>
                    <li><a class="atab" href="#signatures">Signatures</a></li>
                    <li><a class="atab" href="#contracts">Contracts</a></li>
                    <li><a class="atab" href="#warranty" style="display:none">Warranty</a></li>
                   
                </ul>
                <br/>
                <div id="info">
                    <?php $this->renderPartial('_form',array(
                        'model'=>$model,
                    ));?>
                </div>
                <div id="technician">
                    <a class="add-button" id="addTechLink" href='javascript:void(0)'>Add Tech</a>
                  
                    <div id="tech-list">

                    </div>
                </div>
                <div id="equipments">
                    <a class="add-button" id="createDispatchEquipment" href='javascript:void(0)'>Add Equipment</a>
                   
                    <div id="equipment-list">
                    </div>  
                </div>
                <div id="document">
                    <iframe id="downloadFrame" src="" style="display:none;"></iframe>
                    <a class="add-button" id="createDocument" href='javascript:void(0)'>Add Document</a>
                  
                    <div id="document-list"></div>
                </div>
                <div id="part">
                    <a href='javascript:void(0)' class="add-button" id="createPart">Add Part</a>
             
                    <div id="part-list"></div>
                </div>
                <div id="customerNote">
                    <div id="customer-note-list"></div>
                </div>
                <div id="techNote">
                    <a href="javascript:void(0)" class="add-button" id="addTechNote">Add Note</a>
                    <div id="tech-note-list"></div>
                </div>
                <div id="signatures">
                    <a href="javascript:void(0)" class="add-button" id="addSignature">Add Signature</a>
                    <div id="signature-list"></div>
                </div>
                
                <div id="contracts">
                    <?php $this->renderPartial('_contractTab',array(
                    'dispatch'=>$model)); ?>
                </div>
                 <div id="warranty">
                 
                </div>


                
            </div><!-- inside -->
        </div><!-- container -->
    </div><!-- wrap -->
    <?php $this->renderPartial('/copyright'); ?>
</div> <!-- left-col -->

